Ext.ns('Wlanauth')

Wlanauth.BaseGridPanel =  Ext.extend(Ext.grid.GridPanel,{
	editWin:null,
	store:null,
	pageSize:20,
	
	constructor:function(config){
		Ext.apply(this,config);
		
		if(!this.bbar){
			this.bbar = new Ext.PagingToolbar({
			    store:this.store,
			    displayInfo: true,
		        pageSize: this.pageSize,
		        displayInfo:true,
		     	displayMsg:'显示 {0} - {1}  共{2}条记录',
		        emptyMsg:'没有记录'

		   });
		}
		Wlanauth.BaseGridPanel.superclass.constructor.call(this);
		
		Ext.apply(this.store.baseParams,{limit:this.pageSize,dataOnly:false});
		this.addEvents('search','autoload');
		this.on('autoload',this.autoLoadHandler);
		this.on('search',this.searchHandler);
	},
	autoLoadHandler:function(){
		this.store.load({params:{start:0}});
		
	},
	searchHandler:function(params){
		Ext.apply(this.store,{params:params});
		this.store.load();
	},
	getEditWin:function(config){
		if(this.editWin == null){
			Ext.apply(config,{modal:true});
			this.editWin = new Wlanauth.BaseWindow(config);
			
		}
		return this.editWin;
	},
	addSimpleSearchBar:function(searchTypeData,handler){
		var bar = this.getTopToolbar();
		bar.add('->','查找条件','-');
   		bar.add({xtype:'localcombo',data:searchTypeData});
   		bar.add({xtype:'textfield',width:200});
   		bar.add('-',{text:'查找',iconCls:'search',handler:function(){
   			var sType=bar.findByType('textfield')[0].getValue();   
       		var sKey=bar.findByType('textfield')[1].getValue();
       		var p={};
       		if(sKey.length>0){
	       		p[sType] = sKey;
       		}
   			this.store.reload({params:p});
   		},scope:this});
	}
});	